/*
 * tire-agent-blocks/latest-posts-section — self-contained styles
 * (specs/blocks-self-contained-css.md). Mirrors the theme's
 * blocks/{post-listing,post-card,post-card-slider}.css (flattened) plus the
 * inline <style> previously emitted by render.php. Section title, button and
 * category pill come from the shared tire-agent-blocks-shared stylesheet.
 * Fix beyond the theme copy: the category pill is absolutely positioned over
 * the featured image — when a post has no image it overlapped the title; it
 * now flows statically in that case.
 */

/* ---- post listing ---- */
.ta-block-post-listing,
.tire-agent-blocks__post-listing {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* ---- post card ---- */
.ta-block-post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  flex: 1 1 100%;
  min-width: 319px;
  max-width: 445px;
  scroll-snap-align: start;
}

.ta-block-post-card__image {
  margin-block-end: 8px;
  border-radius: 10px;
  border: 2px solid var(--ta-color-neutral-300);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.00) 67.91%, rgba(0, 0, 0, 0.40) 100%);
}

.ta-block-post-card__title,
.ta-block-post-card__description {
  text-align: left;
}

.ta-block-post-card__title {
  margin-block: 0;
  -webkit-line-clamp: 2;
}

.ta-block-post-card__description,
.ta-block-post-card__description p {
  color: var(--ta-color-neutral-400);
  -webkit-line-clamp: 3;
  font-size: 14px;
  line-height: 140% !important;
}

.ta-block-post-card__category {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 1;
}

.ta-block-post-card__category-link {
  position: absolute;
  width: 100%;
}

/* Overlap fix: no featured image → the pill flows above the title instead of
   sitting on it (the absolute position assumes the image is underneath). */
.ta-block-post-card:not(:has(.ta-block-post-card__image)) .ta-block-post-card__category {
  position: static;
}

.ta-block-post-card:not(:has(.ta-block-post-card__image)) .ta-block-post-card__category-link {
  position: static;
  width: auto;
}

.ta-block-post-card__title a,
.posts .ta-block-post-card__title a {
  color: var(--ta-color-neutral-900) !important;
  text-decoration: none;
  font-size: 24px;
  font-weight: 900;
  line-height: 116%;
}

@media screen and (min-width: 1200px) {
  .ta-block-post-card__image {
    margin-block-end: 12px;
  }

  .ta-block-post-card__description,
  .ta-block-post-card__description p {
    font-size: 16px;
    line-height: 150% !important;
  }

  .ta-block-post-card__title a,
  .posts .ta-block-post-card__title a {
    line-height: 120%;
  }
}

/* ---- post card slider ---- */
.ta-block-post-card-slider {
  width: 100%;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
}

.ta-block-post-card-slider__posts {
  display: flex;
  flex-direction: row;
  gap: 32px;
  padding-block: 24px;
}

@media screen and (min-width: 1024px) {
  .ta-block-post-card-slider__posts {
    padding-block: 60px;
  }
}

/* ---- moved from render.php's inline <style> ---- */
@media screen and (max-width: 639px) {
  .ta-latest-posts-swiper .swiper-slide.ta-block-post-card {
    max-width: 100% !important;
  }
}

.ta-latest-posts-swiper-nav {
  text-align: center;
  margin-bottom: 15px;
}

.ta-latest-posts-swiper-nav .swiper-pagination-bullet {
  width: 10px;
  height: 10px;
  margin: 0 5px;
  background-color: var(--ta-color-neutral-400);
  opacity: 1;
}

:where(.editor-styles-wrapper) .swiper-wrapper.ta-block-post-card-slider__posts {
  gap: 32px !important;
}
